import qs from "qs";
import request from "@/utils/request";

export function getArticleList(pageOpts, hideloading = false) {
  return request({
    url: `/web/article/?${qs.stringify(pageOpts)}`,
    method: "get",
    hideloading,
  });
}

export function getArticle(id) {
  return request({
    url: `/web/article/${id}`,
    method: "get",
  });
}


export function updateArticle(id, data) {
  return request({
    url: `/web/article/${id}?${qs.stringify(data)}`,
    method: "patch",
  });
}

export function addArticle(data) {
  return request({
    url: `/web/article/?${qs.stringify(data)}`,
    method: "post",
  });
}

export function delArticle(id) {
  return request({
    url: `/web/article/${id}`,
    method: "delete",
  });
}